package com.chandra.pos;

import com.chandra.pos.customer.dao.entity.Customer;
import org.springframework.dao.DataAccessException;

import javax.inject.Named;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Customer: Admin
 * Date: 10/6/13
 * Time: 10:52 PM
 * To change this template use File | Settings | File Templates.
 */
@Named("loginBean")
public class LoginBean {

    private static final String SUCCESS = "success";
    private static final String ERROR = "error";

     private String username;

    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String login() {
        try {
            Customer customer = new Customer();
            // customer.setId(getId());
            Random random=new Random();
            customer.setId(random.nextLong());


            return SUCCESS;
        } catch (DataAccessException e) {
            e.printStackTrace();
        }

        return ERROR;
    }

    public void reset() {

        this.setUsername("");
        this.setPassword("");

    }
}
